﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Newtonsoft.Json;
using PokemonTCGBL;
using System.Data;

namespace PokemonTCG.Handlers
{
    /// <summary>
    /// Descripción breve de DecksHandler
    /// </summary>
    public class DecksHandler : IHttpHandler
    {

        public void ProcessRequest(HttpContext context)
        {
            string action = context.Request["action"];
            switch (action)
            {
                case "deckdetail":
                    context.Response.Write(GetDeckDetail(Convert.ToInt32(context.Request["iddeck"])));
                    break;
            }
        }

        private string GetDeckDetail(int IdDeck)
        {
            DataTable dt = DecksBL.GetDeckDetailByIdDeck(IdDeck);
            string str = JsonConvert.SerializeObject(dt);
            return str;
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}